#ifndef FTPWINDOW_H
#define FTPWINDOW_H

#include <QDialog>
#include <QHash>

QT_BEGIN_NAMESPACE
class QDialogButtonBox;
class QFile;
class QFtp;
class QLabel;
class QLineEdit;
class QTreeWidget;
class QTreeWidgetItem;
class QProgressDialog;
class QPushButton;
class QUrlInfo;
class QNetworkSession;
class QAction;
class QMenu;
class QMenuBar;
class QFileDialog;
class QProgressDialog;
class QTranslator;
class QLibraryInfo;
class QProcess;

QT_END_NAMESPACE

class FtpWindow : public QDialog
{
    Q_OBJECT

public:
    FtpWindow(QWidget *parent = 0);
    QSize sizeHint() const;
    bool removeDir(const QString &dirName);

private slots:

    void createMenu();
    void connectOrDisconnect();
    void downloadFile();
    void cancelDownload();
    void ftpCommandFinished(int commandId, bool error);
    void addToList(const QUrlInfo &urlInfo);
    void processItem(QTreeWidgetItem *item, int column);
    void cdToParent();
    void updateDataTransferProgress(qint64 readBytes,
                                    qint64 totalBytes);
    void enableDownloadButton();
    void enableConnectButton();
    void about();
    void aboutQt();
    void changename();
    void makedir();
    void deletefiles();
    void uploadFile();
    void defaultPort();

    void removeDirF();
private:
    QLabel *ftpServerLabel;
    QLabel *ftpServerLabelPassword;
    QLabel *ftpServerLabelUsername;
    QLabel *ftpServerLabelRename;
    QLabel *ftpServerLabelMakeDir;
    QLabel *ftpServerLabelPort;
    QLabel *statusLabel;
    QLabel *infoLabel;
    QLabel *imageLabel;
    QLabel *imageLabel2;

    QLineEdit *ftpServerLineEdit;
    QLineEdit *ftpServerLineEditUsername;
    QLineEdit *ftpServerLineEditPassword;
    QLineEdit *ftpServerLineEditMakeDir;
    QLineEdit *ftpServerLineEditRename;
    QLineEdit *ftpServerLineEditPort;

    QTreeWidget *fileList;

    QPushButton *cdToParentButton;
    QPushButton *connectButton;
    QPushButton *downloadButton;
    QPushButton *quitButton;
    QPushButton *makeDirButton;
    QPushButton *deleteButton;
    QPushButton *renameButton;
    QPushButton *uploadButton;
    QDialogButtonBox *buttonBox;
    QPushButton *buttonDefaultPort;

    QProgressDialog *progressDialog;

    QMenuBar *menuBar;
    QMenu *fileMenu;
    QMenu *helpMenu;

    QAction *exitAction;
    QAction *aboutAct;
    QAction *aboutQtAct;
    QAction *helpAct;
    QAction *deleteAct;
    QAction *makeDirAct;
    QAction *renameAct;
    QAction *downloadAct;
    QAction *connectAct;
    QAction *uploadAct;

    QHash<QString, bool> isDirectory;
    QString currentPath;
    QFtp *ftp;
    QFile *file;
    QNetworkSession *networkSession;


};

#endif
